package com.narunas;


import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

public class ButtonsSkinned extends Activity{

	public Menu mMenu;
	private static final int btnMenuResources[] = { R.menu.submenu_skin_btns};
	public ImageButton d_btn;
	GradientDrawable bcgradient;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
        
		super.onCreate(savedInstanceState);
        setContentView(R.layout.buttonsskinned);
      
        
        
        ImageButton btn = (ImageButton)findViewById(R.id.ImageButton01);
        btn.setOnClickListener(onClickListener);
       
        
        d_btn = (ImageButton)findViewById(R.id.ImageButton02);
        d_btn.setEnabled(false);
        d_btn.setOnClickListener(onClickListener);
        
        // instructions
        drawInstructionsToast();
    }
	
	public OnTouchListener onImageButtonTouch = new OnTouchListener(){

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			// TODO Auto-generated method stub
			return false;
		}
		
		
		
	};
	
	// Bottom MENU stuff
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
      
        mMenu = menu;
        
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(btnMenuResources[0], menu);      
        return true;
    };
    
	public OnClickListener onClickListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			
			drawClickedToast();
		}
		
	};
	
	protected final void handleButtonState() {
		
		d_btn.setEnabled(true);
		
	};
	
	@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            
        	case R.id.item01:
            
        		handleButtonState();
        		
            return true;
            
           default:
            	
                
           break;
        }
        
        return false;
    }

	protected final void drawInstructionsToast() {
		
		Toast.makeText(this, "Please use sub menu on your device to enable the state of lower button\nUse roller ball to simmulate 'over'", Toast.LENGTH_LONG).show();
		
	}
	
	protected final void drawClickedToast(){
		
		Toast.makeText(this, "this button has been clicked", Toast.LENGTH_SHORT).show();
	}
}
